import { NextResponse } from 'next/server';
import { prisma } from '@/lib/db';

export async function GET() {
  try {
    const positions = await prisma.position.findMany({
      include: {
        token: true
      },
      orderBy: {
        createdAt: 'desc'
      }
    });
    
    return NextResponse.json(positions);
  } catch (error) {
    console.error('获取持仓信息失败:', error);
    return NextResponse.json({ error: '获取持仓信息失败' }, { status: 500 });
  }
}
